Review of Week 1 Homework:

Write a program that prints "Hello World" (or some variant of it) and consider adding interaction.

Working:


In [7]:
print("Hello, world")


Hello, world

Not working:


In [2]:
# Python 2 version
print("Hello, world")


Hello, world

Troubleshooting:

  1. Double quotes, especially if pasted in fromm Word or PowerPoint, can cause problems

In [3]:
print(Hello world)


  File "<ipython-input-3-8de83d741442>", line 1
    print(“Hello world“)
               ^
SyntaxError: invalid character in identifier

In [5]:
print("Hello world")


Hello world

In [8]:
import unicodedata

In [10]:
# Good double quote:
unicodedata.category('"')


Out[10]:
'Po'

In [13]:
# Good single quote
unicodedata.category("'")


Out[13]:
'Po'

In [9]:
# BAD...double quote
unicodedata.category('“')


Out[9]:
'Pi'

In [14]:
# BAD...single quote
unicodedata.category("`")


Out[14]:
'Sk'

SOLUTION: Paste code into a basic text editor first, then replace quotes if you suspect thay are causing a problem.


In [ ]:
name = input()
print("Hello" + name)

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: